package com.tuangou.tuangouorder.order.controller;

import com.atguigu.common.utils.PageUtils;
import com.atguigu.common.utils.R;
import com.tuangou.tuangouorder.order.entity.GroupRecordEntity;
import com.tuangou.tuangouorder.order.service.GroupRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author lsy
 * @email lsy@tuangou.com
 * @date 2021-06-18 20:36:33
 */
@RestController
@RequestMapping("order/grouprecord")
public class GroupRecordController {
    @Autowired
    private GroupRecordService groupRecordService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("order:grouprecord:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = groupRecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("order:grouprecord:info")
    public R info(@PathVariable("id") Integer id){
		GroupRecordEntity groupRecord = groupRecordService.getById(id);

        return R.ok().put("groupRecord", groupRecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("order:grouprecord:save")
    public R save(@RequestBody GroupRecordEntity groupRecord){
		groupRecordService.save(groupRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("order:grouprecord:update")
    public R update(@RequestBody GroupRecordEntity groupRecord){
		groupRecordService.updateById(groupRecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("order:grouprecord:delete")
    public R delete(@RequestBody Integer[] ids){
		groupRecordService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
